<?php
function uploadOne($img = 'picUrl', $type = 'thumb')
{

    $file = request()->file($img);
//    halt($_FILES);
    write_log(json_encode($file));
    if (!empty($file)) {

        // 移动到框架应用根目录/public/uploads/ 目录下
        $upload = $file->move(ROOT_PATH . 'public' . DS . 'uploads');

        // halt($upload);
        if ($upload) {

            if ($type == 'thumb') {
                //图片处理
                imgDispose('public' . DS . 'uploads' . DS . $upload->getSaveName());
            }

            //返回图片地址
            return 'uploads/' . date('Ymd') . '/' . $upload->getFilename();
        }
        return $file->getError();
    }
    return request()->param($img,'');
}
